package com.puwang.tbmpro;
import android.app.Activity;
import android.os.Bundle;
import android.widget.RelativeLayout;

public class LauncherActivity extends Activity {
    private MySurfaceView mGLSurfaceView;
    private CameraSerfaceView cameraSerfaceView;
    private RelativeLayout rela_layout_camera,rela_layout_glSurfaceView;
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);
        rela_layout_camera = (RelativeLayout) findViewById(R.id.rela_layout_camera);
        rela_layout_glSurfaceView = (RelativeLayout) findViewById(R.id.rela_layout_glSurfaceView);

        //摄像机
        rela_layout_camera.removeAllViews();
        cameraSerfaceView = new CameraSerfaceView(LauncherActivity.this);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MATCH_PARENT,
                RelativeLayout.LayoutParams.MATCH_PARENT);
        rela_layout_camera.addView(cameraSerfaceView, params);

        //OpenGL
        rela_layout_glSurfaceView.removeAllViews();
        mGLSurfaceView = new MySurfaceView(LauncherActivity.this);
        RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.MATCH_PARENT,
                RelativeLayout.LayoutParams.MATCH_PARENT);
        rela_layout_glSurfaceView.addView(mGLSurfaceView, params2);
    }

    @Override
    protected void onResume() {
        super.onResume();
        mGLSurfaceView.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        mGLSurfaceView.onPause();
    }
}



